<template>
  <div class=" h100 fd ">
    
    <EasyPrint   v-model="previewDrawer"
    :richTextContent="richTextContent"
    :dataSource="datasource" 
    @handlePreview="handlePreview"
    @handleSave="handleSave"
    >
      
        </EasyPrint> 
        <PreviewPrint 
    renderType="render" 
      v-model="previewDrawer" :options="{
        ...previewData
      }"/>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
import richTextContent from './richTextContent.vue'
const previewDrawer = ref(false)
const previewData = ref()

const handleSave = (val:boolean,data:any)=>{

}
const handlePreview = (val:boolean,data:any)=>{
previewDrawer.value  = val;
previewData.value = data;
}
const datasource = [
    {
        "module_name": "客户",
        "module_field": "customer",
        "module_content": [
            {
                "field": "editor_1732505813",
                "name": "编辑器",
                "field_data_id": 1
            },
            {
                "field": "checkbox_1700212268",
                "name": "多选框组",
                "field_data_id": 1
            },
            {
                "field": "selectcheckbox_1692251151",
                "name": "公司大小",
                "field_data_id": 1
            },
            {
                "field": "cascader_1692251051",
                "name": "级联选择器",
                "field_data_id": 1
            },
            {
                "field": "select_1692251046",
                "name": "公司规模",
                "field_data_id": 1
            },
            {
                "field": "email",
                "name": "邮箱地址",
                "field_data_id": 1
            },
            {
                "field": "description",
                "name": "备注",
                "field_data_id": 1
            },
            {
                "field": "address",
                "name": "地址",
                "field_data_id": 1
            },
            {
                "field": "industry",
                "name": "营业额",
                "field_data_id": 1
            },
            {
                "field": "origin",
                "name": "客户来源",
                "field_data_id": 1
            },
            {
                "field": "grade",
                "name": "等级",
                "field_data_id": 1
            },
            {
                "field": "customer_status",
                "name": "跟进状态",
                "field_data_id": 1
            },
            {
                "field": "website",
                "name": "地址",
                "field_data_id": 1
            },
            {
                "field": "mobile",
                "name": "客户电话",
                "field_data_id": 1
            },
            {
                "field": "name",
                "name": "客户名称",
                "field_data_id": 1
            },
            {
                "field": "number",
                "name": "客户编号",
                "field_data_id": 1
            },
            {
                "field": "creation_method",
                "name": "创建方式",
                "field_data_id": 1
            },
            {
                "field": "visible_user_ids",
                "name": "团队成员",
                "field_data_id": 1
            },
            {
                "field": "last_contact_time",
                "name": "最近跟进时间",
                "field_data_id": 1
            },
            {
                "field": "lock_flag",
                "name": "锁定状态",
                "field_data_id": 1
            },
            {
                "field": "address_location",
                "name": "经纬度坐标",
                "field_data_id": 1
            },
            {
                "field": "next_contact_time",
                "name": "下次联系时间",
                "field_data_id": 1
            },
            {
                "field": "contacts",
                "name": "首要联系人",
                "field_data_id": 1
            },
            {
                "field": "deal_state",
                "name": "客户成交状态",
                "field_data_id": 1
            },
            {
                "field": "last_pool_time",
                "name": "最近回收时间",
                "field_data_id": 1
            },
            {
                "field": "recycle_days",
                "name": "距离回收天数",
                "field_data_id": 1
            },
            {
                "field": "owner_user_id",
                "name": "负责人",
                "field_data_id": 1
            },
            {
                "field": "owner_dep_id",
                "name": "负责人部门",
                "field_data_id": 1
            },
            {
                "field": "creator_user_id",
                "name": "创建人",
                "field_data_id": 1
            },
            {
                "field": "create_time",
                "name": "创建时间",
                "field_data_id": 1
            },
            {
                "field": "update_time",
                "name": "更新时间",
                "field_data_id": 1
            }
        ]
    },
    {
        "module_name": "联系人",
        "module_field": "contact",
        "module_content": [
            {
                "field": "input_1646201281",
                "name": "身份证号",
                "field_data_id": 2
            },
            {
                "field": "customer_id",
                "name": "相关客户",
                "field_data_id": 2
            },
            {
                "field": "description",
                "name": "备注",
                "field_data_id": 2
            },
            {
                "field": "address",
                "name": "地址",
                "field_data_id": 2
            },
            {
                "field": "qq",
                "name": "QQ",
                "field_data_id": 2
            },
            {
                "field": "wechat",
                "name": "微信",
                "field_data_id": 2
            },
            {
                "field": "birthday",
                "name": "出生日期",
                "field_data_id": 2
            },
            {
                "field": "sex",
                "name": "尊称",
                "field_data_id": 2
            },
            {
                "field": "email",
                "name": "电子邮件",
                "field_data_id": 2
            },
            {
                "field": "phone",
                "name": "座机",
                "field_data_id": 2
            },
            {
                "field": "mobile",
                "name": "手机",
                "field_data_id": 2
            },
            {
                "field": "post",
                "name": "职务",
                "field_data_id": 2
            },
            {
                "field": "name",
                "name": "姓名",
                "field_data_id": 2
            },
            {
                "field": "visible_user_ids",
                "name": "团队成员",
                "field_data_id": 2
            },
            {
                "field": "owner_user_id",
                "name": "负责人",
                "field_data_id": 2
            },
            {
                "field": "owner_dep_id",
                "name": "负责人部门",
                "field_data_id": 2
            },
            {
                "field": "creator_user_id",
                "name": "创建人",
                "field_data_id": 2
            },
            {
                "field": "create_time",
                "name": "创建时间",
                "field_data_id": 2
            },
            {
                "field": "update_time",
                "name": "更新时间",
                "field_data_id": 2
            }
        ]
    },
    {
        "module_name": "商机",
        "module_field": "opportunity",
        "module_content": [
            {
                "field": "cascader_1691116992",
                "name": "级联选择器",
                "field_data_id": 3
            },
            {
                "field": "checkbox_1691024297",
                "name": "多选框组",
                "field_data_id": 3
            },
            {
                "field": "selectcheckbox_1691024212",
                "name": "下拉多选框",
                "field_data_id": 3
            },
            {
                "field": "address_1687674528",
                "name": "地址",
                "field_data_id": 3
            },
            {
                "field": "storerole_c_id",
                "name": "店员管理",
                "field_data_id": 3
            },
            {
                "field": "img_1608865197",
                "name": "图片",
                "field_data_id": 3
            },
            {
                "field": "description",
                "name": "备注",
                "field_data_id": 3
            },
            {
                "field": "level",
                "name": "商机级别",
                "field_data_id": 3
            },
            {
                "field": "source",
                "name": "商机来源",
                "field_data_id": 3
            },
            {
                "field": "group_id",
                "name": "商机流程组",
                "field_data_id": 3
            },
            {
                "field": "price",
                "name": "商机金额(元)",
                "field_data_id": 3
            },
            {
                "field": "expected_date",
                "name": "预计成交日期",
                "field_data_id": 3
            },
            {
                "field": "name",
                "name": "商机名称",
                "field_data_id": 3
            },
            {
                "field": "customer_id",
                "name": "客户",
                "field_data_id": 3
            },
            {
                "field": "number",
                "name": "商机编号",
                "field_data_id": 3
            },
            {
                "field": "process_id",
                "name": "商机流程",
                "field_data_id": 3
            },
            {
                "field": "visible_user_ids",
                "name": "团队成员",
                "field_data_id": 3
            },
            {
                "field": "state",
                "name": "结束状态",
                "field_data_id": 3
            },
            {
                "field": "state_reason",
                "name": "结束理由",
                "field_data_id": 3
            },
            {
                "field": "state_remark",
                "name": "结束备注",
                "field_data_id": 3
            },
            {
                "field": "next_contact_time",
                "name": "下次联系时间",
                "field_data_id": 3
            },
            {
                "field": "owner_user_id",
                "name": "负责人",
                "field_data_id": 3
            },
            {
                "field": "owner_dep_id",
                "name": "负责人部门",
                "field_data_id": 3
            },
            {
                "field": "creator_user_id",
                "name": "创建人",
                "field_data_id": 3
            },
            {
                "field": "create_time",
                "name": "创建时间",
                "field_data_id": 3
            },
            {
                "field": "update_time",
                "name": "更新时间",
                "field_data_id": 3
            }
        ]
    },
    {
        "module_name": "合同",
        "module_field": "contract",
        "module_content": [
            {
                "field": "file_1742364830",
                "name": "合同附件",
                "field_data_id": 5
            },
            {
                "field": "address_1687679485",
                "name": "地址",
                "field_data_id": 5
            },
            {
                "field": "quotation_id",
                "name": "报价单",
                "field_data_id": 5
            },
            {
                "field": "product_price",
                "name": "产品总金额(元)",
                "field_data_id": 5
            },
            {
                "field": "contact_email",
                "name": "联系人邮箱",
                "field_data_id": 5
            },
            {
                "field": "contact_mobile",
                "name": "联系人手机",
                "field_data_id": 5
            },
            {
                "field": "contact_id",
                "name": "联系人",
                "field_data_id": 5
            },
            {
                "field": "renew",
                "name": "合同类型",
                "field_data_id": 5
            },
            {
                "field": "end_time",
                "name": "合同到期时间",
                "field_data_id": 5
            },
            {
                "field": "start_time",
                "name": "合同生效时间",
                "field_data_id": 5
            },
            {
                "field": "signing_time",
                "name": "签约时间",
                "field_data_id": 5
            },
            {
                "field": "price",
                "name": "合同金额(元)",
                "field_data_id": 5
            },
            {
                "field": "opportunity_id",
                "name": "来源商机",
                "field_data_id": 5
            },
            {
                "field": "customer_id",
                "name": "来源客户",
                "field_data_id": 5
            },
            {
                "field": "name",
                "name": "合同名称",
                "field_data_id": 5
            },
            {
                "field": "number",
                "name": "合同编号",
                "field_data_id": 5
            },
            {
                "field": "contract_money_dx",
                "name": "合同金额(大写)",
                "field_data_id": 5
            },
            {
                "field": "payment_money",
                "name": "已回/剩余(元)",
                "field_data_id": 5
            },
            {
                "field": "payment_status",
                "name": "回款状态",
                "field_data_id": 5
            },
            {
                "field": "renew_id",
                "name": "续约合同",
                "field_data_id": 5
            },
            {
                "field": "discount",
                "name": "总折扣（%）",
                "field_data_id": 5
            },
            {
                "field": "state",
                "name": "合同状态",
                "field_data_id": 5
            },
            {
                "field": "approval_state",
                "name": "审核状态",
                "field_data_id": 5
            },
            {
                "field": "void_time",
                "name": "作废时间",
                "field_data_id": 5
            },
            {
                "field": "void_reason",
                "name": "作废原因",
                "field_data_id": 5
            },
            {
                "field": "channel_id",
                "name": "渠道商",
                "field_data_id": 5
            },
            {
                "field": "channel_user_id",
                "name": "渠道负责人",
                "field_data_id": 5
            },
            {
                "field": "out_status",
                "name": "出库状态",
                "field_data_id": 5
            },
            {
                "field": "owner_user_id",
                "name": "负责人",
                "field_data_id": 5
            },
            {
                "field": "owner_dep_id",
                "name": "负责人部门",
                "field_data_id": 5
            },
            {
                "field": "creator_user_id",
                "name": "创建人",
                "field_data_id": 5
            },
            {
                "field": "create_time",
                "name": "创建时间",
                "field_data_id": 5
            },
            {
                "field": "update_time",
                "name": "更新时间",
                "field_data_id": 5
            }
        ]
    }
]
const option ={}
</script>

<style scoped lang="scss">
.doacument{
}
</style>
